package com.yenlien.traceyun.control.controller;

import com.yenlien.traceyun.control.entity.Shelves;
import com.yenlien.traceyun.control.service.ShelvesService;
import com.yenlien.traceyun.webase.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @author jialong
 * @date 2021/05/18
 * @description: 仓库
 **/
@RestController
@RequestMapping("/shelves")
public class ShelvesController extends BaseController {

    @Autowired
    private ShelvesService shelvesService;


    @PostMapping(value = "/save")
    public Object save(@Validated Shelves shelves) throws Exception {
        return success(shelvesService.save(shelves));
    }

    @PostMapping(value = "/findList")
    public Object findByList(@RequestBody Shelves shelves) {
        return buildPage(shelvesService.findList(shelves));
    }


    @GetMapping(value = "/findById/{id}")
    public Object findById(@PathVariable Long id) {
        return success(shelvesService.findById(id));
    }


}
